fix(rivetkit): surface native sqlite kv errors to callers#4645
fix(rivetkit): surface native sqlite kv errors to callers#4645NathanFlurry wants to merge 1 commit intofix/prevent-sleep-db-racesfrom
Conversation
|
PR Review: fix(rivetkit): surface native sqlite kv errors to callers Overview: This PR improves debuggability of native SQLite KV failures by enriching I/O-related SQLite errors with the underlying KV channel error. The approach is clean and targeted. Code Quality - Strengths: (1) enrichNativeDatabaseError has a never return type, ensuring TypeScript knows catch branches always terminate - important for the exec wrapper where result must be definitively assigned. (2) The deduplication guard prevents double-appending. (3) takeLastKvError uses optional chaining appropriately as a best-effort diagnostic path, per CLAUDE.md guidance. (4) Error message mutation preserves the original stack trace. Minor Issues: (1) Incomplete test coverage - tests only exercise the run path; exec and query have no coverage. Consider adding a test for query to verify the pattern holds. (2) Narrow I/O error regex - the pattern may miss other SQLite I/O codes like SQLITE_IOERR_READ or disk full errors; a short comment on what the regex intends to catch would help future maintainers. (3) Unfilled PR description - the checklist and test description sections are blank. Correctness: No issues found. enrichNativeDatabaseError always throws (never), so post-try/catch code is only reachable on success. The KV error is only attached when both the SQLite error is I/O-related AND a KV error exists. The optional takeLastKvError interface extension is non-breaking. Summary: Clean, well-scoped fix. Two suggestions before merge: (1) add test coverage for exec or query paths, (2) add a brief comment on the regex scope. Everything else looks good. Generated with Claude Code |
7825238 to
f6957bf
Compare
c3091c0 to
bb11c47
Compare
f6957bf to
8584a4e
Compare
bb11c47 to
4a0f066
Compare

Description
Please include a summary of the changes and the related issue. Please also include relevant motivation and context.
Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes.
Checklist: